Stored Procedures [dbo].[amsp_CMReorderContentFolder]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)
@InNavMenuIDnumeric(18,0)9
Permissions
TypeActionOwning Principal
GrantExecuteIMIS
SQL Script
-- =============================================
-- This stored procedure places specified content folder at the correct position.
-- Content folders are ordered alphabetically.
--
-- Modifications
-- 09/04/2003  E.Tatsui    Created
-- =============================================


CREATE            PROCEDURE amsp_CMReorderContentFolder
  @InNavMenuID numeric
AS
BEGIN
  DECLARE
    @ParentNavMenuID numeric,
    @RootFolderID numeric


  SELECT @ParentNavMenuID = ParentNavMenuID
    FROM Nav_Menu WITH (NOLOCK)
   WHERE NavMenuID = @InNavMenuID

  -- If there is a parent for this item, just call another sp and let it move.
  IF @ParentNavMenuID IS NOT NULL
    EXEC amsp_CMMoveContentFolder @InNavMenuID, @ParentNavMenuID, NULL
  ELSE BEGIN
  -- if this is level 1 and no parent, pass the root of content folder as parent id.
    SELECT TOP 1 @RootFolderID = NavMenuID
      FROM Nav_Menu WITH (NOLOCK)
     WHERE NavContentGroupInd = 'C'
       AND CategoryDepth = 0
     ORDER BY SortOrder
    EXEC amsp_CMMoveContentFolder @InNavMenuID, @RootFolderID, NULL
  END
END

GO
GRANT EXECUTE ON  [dbo].[amsp_CMReorderContentFolder] TO [IMIS]
GO
Uses